package com.malguy.services;

import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author malguy-wang sir
 * @create ${year}-${month}-${day}-${time}
 */
public class load1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置字符集
        req.setCharacterEncoding("utf-8");
        //获取参数
        String username = req.getParameter("username");
        //在共享的request域里设置参数
        req.setAttribute("username",username);
        //获取请求调度器（dispatcher的翻译）
        RequestDispatcher dispatcher = req.getRequestDispatcher("/load2");
       //请求转发
        dispatcher.forward(req,resp);
    }
}
